package ir;

import run.Cell;
import run.Lattice;

/**
 * The generalized Cell. The Cell is responsible for managing bindings, facets, 
 * and intracellular transportation of data subcells.
 * 
 * User-defined cells "speciate" from this stem cell by providing their own
 * Structural Definition (a blueprint) that is realized into an actual Lattice of
 * subcells that govern the cell's behavior.
 * 
 * All Cells perform a computation when stimulated on their (satisfied) facets.
 * 
 * Cells manage the set of facets that they own and manage the flow of computation
 * through their internal subcell structure -- the lattice.
 * 
 * 
 * @author Thomas Chau
 *
 */
public class CellDef {

	protected String cellTypeName;
	protected StructuralDefinition d;
 
	public CellDef(String name) {
		this.cellTypeName = name;
	} 
	
	public void setStructure(StructuralDefinition d) {
		this.d = d;
	}
	
	/**
	 * Constructs the Cellular structure and returns reference to it. 
	 */
	public Cell realize() {
//		System.out.println("CellDef: Lattice of " + cellTypeName + " realizing...");
		return d.clone().realize(cellTypeName);
	}
	
	public String getName() {
		return cellTypeName;
	}
}
